$(function(){
	
	var appUrl = '/tp3/index.php/index';
	
	/*
	var cStartDate = moment().add(2, 'days').toDate();
	var cEndDate = moment().add(60, 'days').toDate();
	$('#cal').datepicker({
		format: 'dd/mm/yyyy',
		todayHighlight: true,
		startDate:cStartDate,
		endDate:cEndDate,
		autoclose:true,
		language: 'de'
	}).on('changeDate', function(e){
		if(typeof e.date != 'undefined'){
			var st = e.date.getTime()/1000;
			$('.modal-content').load(appUrl + '/getModelForm?st=' + st,function(data){
				if(data != ''){
					$('#myModal').modal('toggle');
				}
			});
		}
	});
	$('#main-alert').hide();
	*/
	var successAlert = '<div class="alert alert-success alert-dismissible fade in success-alert" role="alert"><button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true" style="vertical-align:top;">&times;</span></button>*Eine E-Mail wurde gesendet. Bitte &uuml;berpr&uuml;fen Sie Ihre E-Mail f&uuml;r die Anmeldebest&auml;tigung.</div>';
	
	$('.anmelden').click(function(e){
		e.preventDefault();
		$('.modal-content').load(appUrl + '/getModelForm?tid=' + $(this).attr('data-target'),function(data){
			if(data != ''){
				$('#myModal').modal('toggle');
			}
		});
		$(".success-alert").remove();
		$(this).parent().after(successAlert);
		$(".success-alert").hide();
	})
})